﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Menu.Master" AutoEventWireup="true" CodeBehind="PackingList.aspx.cs" Inherits="Emporium_Web.PackingList" Theme="Constellation" %>

<%@ MasterType VirtualPath="~/Menu.master" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <title>Listado de Estilos</title>
    <script type="text/javascript">
        var hdnSeleccionId = '<%= this.hdnSeleccion.ClientID %>';
    </script>
    <script type="text/javascript" src="js/funciones.grid.js"></script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <!-- Content -->
    <article class="container_12">
		<section class="grid_12">
			<div class="block-border">
			<form runat="server" class="block-content form" id="table_form">
            
            <ajaxtoolkit:toolkitscriptmanager ID="toolk" runat="server"  EnableScriptGlobalization="true" EnableScriptLocalization="true" EnablePageMethods="true"></ajaxtoolkit:toolkitscriptmanager>
			
            <h1>Packing List</h1>

                <div style="width: 100%; padding-top: 20px;">
                      <div style="width: 100%; height: 45px; float: inherit;">
                            <div style="width: 100px; float: left;">
                                <label>
                                        Nro Packing</label>
                            </div>
                            <div align="left" style="width: 70%; float: left;">
                                <asp:TextBox ID="txtNroPacking" name="simple-required" runat="server" Width="100px" Style="text-align:right;" onKeyPress ='return ValidarInputNumerico(event)'></asp:TextBox>
                            </div>
                      </div>     
                    
                      <div style="width: 100%; height: 45px; float: inherit;">
                        <div style="width: 100px; float: left;">
                            <label>
                                    Nro Ped.Comp.</label>
                        </div>
                        <div align="left" style="width: 70%; float: left;">
                            <asp:TextBox ID="txtNroPedidoCompra" name="simple-required" runat="server" Width="100px" Style="text-align:right;" onKeyPress ='return ValidarInputNumerico(event)'></asp:TextBox>
                        </div>
                    </div>  
                    
                     <div style="width: 100%; height: 45px; float: inherit;">
                        <div style="width: 100px; float: left;">
                            <label>Fecha Inicio</label>
                        </div>
                        <div align="left" style="width: 30%; float: left;">
                              <asp:TextBox ID="txtFechaInicio" runat="server" Width="100px" MaxLength="1" style="text-align:justify"/>
                            <asp:ImageButton ID="imgFechaInicio" runat="server" ImageUrl="~/images/Calendar_scheduleHS.png" CausesValidation="False" />
                            <ajaxToolkit:MaskedEditExtender ID="meeFechaInicio" runat="server"
                                TargetControlID="txtFechaInicio"
                                Mask="99/99/9999"
                                MaskType="Date"
                                ErrorTooltipEnabled="True" CultureAMPMPlaceholder="" 
                                CultureCurrencySymbolPlaceholder="" CultureDateFormat="" 
                                CultureDatePlaceholder="" CultureDecimalPlaceholder="" 
                                CultureThousandsPlaceholder="" CultureTimePlaceholder="" Enabled="True" />
                            <ajaxToolkit:MaskedEditValidator ID="mevFechaInicio" runat="server"
                                ControlExtender="meeFechaInicio"
                                ControlToValidate="txtFechaInicio"                                
                                InvalidValueMessage="Fecha es invalida"
                                IsValidEmpty="true"
                                Display="Dynamic"
                                TooltipMessage="Ingrese una fecha"                                                
                                ErrorMessage="mevFechaInicio" />
                             <ajaxToolkit:CalendarExtender ID="ceFechaInicio" runat="server" 
                                  TargetControlID="txtFechaInicio" PopupButtonID="imgFechaInicio" 
                                  Enabled="True" /> 
                        </div>
                         <div align="left" style="width: 20%; float: left; text-align:left;">
                             
                        </div>
                    </div>
                    
                     <div style="width: 100%; height: 45px; float: inherit;">
                        <div style="width: 100px; float: left;">
                            <label>Fecha Fin</label>
                        </div>
                       <div align="left" style="width: 30%; float: left;">
                              <asp:TextBox ID="txtFechaFin" runat="server" Width="100px" MaxLength="1" style="text-align:justify"/>
                            <asp:ImageButton ID="imgFechaFin" runat="server" ImageUrl="~/images/Calendar_scheduleHS.png" CausesValidation="False" />
                            <ajaxToolkit:MaskedEditExtender ID="meeFechaFin" runat="server"
                                TargetControlID="txtFechaFin"
                                Mask="99/99/9999"
                                MaskType="Date"
                                ErrorTooltipEnabled="True" CultureAMPMPlaceholder="" 
                                CultureCurrencySymbolPlaceholder="" CultureDateFormat="" 
                                CultureDatePlaceholder="" CultureDecimalPlaceholder="" 
                                CultureThousandsPlaceholder="" CultureTimePlaceholder="" Enabled="True" />
                            <ajaxToolkit:MaskedEditValidator ID="mevFechaFin" runat="server"
                                ControlExtender="meeFechaFin"
                                ControlToValidate="txtFechaFin"                                
                                InvalidValueMessage="Fecha es invalida"
                                IsValidEmpty="true"
                                Display="Dynamic"
                                TooltipMessage="Ingrese una fecha"                                                
                                ErrorMessage="mevFechaFin" />
                             <ajaxToolkit:CalendarExtender ID="ceFechaFin" runat="server" 
                                  TargetControlID="txtFechaFin" PopupButtonID="imgFechaFin" 
                                  Enabled="True" /> 
                        </div>
                         <div align="left" style="width: 20%; float: left; text-align:left;">
                             <asp:LinkButton ID="lnkBuscar" runat="server" Text="Buscar" CssClass="button red" OnClick="btnBuscar_Click" />
                        </div>
                    </div>   
                   
                 </div>

                 
                    <asp:HiddenField ID="hdnSeleccion" runat="server" />
                  
                   <div style="width: 100%;">
					<ul class="message error no-margin" runat="server" id="errorMessage">
					    <li><asp:Label runat="server" ID="lblErrorMessage"></asp:Label></li>
					</ul>
                    <ul class="message warning no-margin" runat="server"  id="warningMessage">
					    <li><asp:Label runat="server" ID="lblWarningMessage"></asp:Label></li>
					</ul>                   
                   </div>
                                      

                    <div class="block-controls">
                        <emporium:pager ID="gvPager" runat="server" Visible="false" PageSize="5" OnPageChanged="gvPagerPageChanged" />
                    </div>
                    <div class="no-margin">
					 <asp:GridView ID="gvPackings" runat="server" SkinID="gridviewSkin" 
                            PageSize="5" Width="100%" onrowdatabound="gvPackings_RowDataBound" 
                            onrowcommand="gvPackings_RowCommand" AutoGenerateColumns="False">
						<Columns>                   
                            
							<asp:TemplateField>
                                <ItemTemplate>
                                      <input id="rbSelect" type="radio" name="selectGroup" value="rbSelect" onclick="javascript:Check('<%# Eval("PacLis_Id") %>');"/>
								</ItemTemplate>
								<ItemStyle HorizontalAlign="Left" Width="2%" />
							</asp:TemplateField>

                            <asp:TemplateField>
                                <HeaderStyle HorizontalAlign="Left" ForeColor="White" Font-Bold="true"></HeaderStyle>
                                <HeaderTemplate>
                                <span class="column-sort">
									<asp:LinkButton Name="lnkSortUpPacking" ID="lnkSortUpPacking" CssClass="sort-up" runat="server" CommandName="SortUp" CommandArgument="Packing"/>
                                    <asp:LinkButton Name="lnkSortDownPacking" ID="lnkSortDownPacking" CssClass="sort-down" runat="server"  CommandName="SortDown" CommandArgument="Packing"/>
								</span>
                                Packing
                                </HeaderTemplate>
                                <ItemTemplate>
                                    <asp:LinkButton ID="btnConsultar" runat="server" Text='<%# Bind("PacLis_Id","{0:00000}") %>' OnClick="btnConsultar_Click"  />
								</ItemTemplate>
                            </asp:TemplateField>

                             <asp:TemplateField>
                                <HeaderStyle HorizontalAlign="Left" ForeColor="White" Font-Bold="true"></HeaderStyle>
                                <HeaderTemplate>
                                <span class="column-sort">
									<asp:LinkButton Name="lnkSortUpPedidoCompra" ID="lnkSortUpPedidoCompra" CssClass="sort-up" runat="server" CommandName="SortUp" CommandArgument="PedidoCompra"/>
                                    <asp:LinkButton Name="lnkSortDownPedidoCompra" ID="lnkSortDownPedidoCompra" CssClass="sort-down" runat="server"  CommandName="SortDown" CommandArgument="PedidoCompra"/>
								</span>
                                Ped.Comp.
                                </HeaderTemplate>
                                <ItemTemplate>
                                    <%# Eval("PedCom_Id", "{0:00000}")%>
                                </ItemTemplate>                                
                            </asp:TemplateField>

                            <asp:TemplateField>
                                <HeaderStyle ForeColor="White" Font-Bold="true"></HeaderStyle>
                                <HeaderTemplate>
                                    <span class="column-sort">
									    <asp:LinkButton ID="lnkSortUpDespacho" CssClass="sort-up" runat="server" CommandName="SortUp" CommandArgument="Despacho"/>
                                        <asp:LinkButton ID="lnkSortDownDespacho" CssClass="sort-down" runat="server"  CommandName="SortDown" CommandArgument="Despacho"/>
								    </span>
                                Despacho
                                </HeaderTemplate>
                                <ItemTemplate>
                                    <%# Eval("PacLis_Despacho", "{0:000}")%>
                                </ItemTemplate>
                            </asp:TemplateField>

                             <asp:TemplateField>
                                <HeaderStyle ForeColor="White" Font-Bold="true"></HeaderStyle>
                                <HeaderTemplate>
                                    <span class="column-sort">
									    <asp:LinkButton ID="lnkSortUpFecha" CssClass="sort-up" runat="server" CommandName="SortUp" CommandArgument="Fecha"/>
                                        <asp:LinkButton ID="lnkSortDownFecha" CssClass="sort-down" runat="server"  CommandName="SortDown" CommandArgument="Fecha"/>
								    </span>
                                   Fecha
                                </HeaderTemplate>
                                <ItemTemplate>
                                    <%# Eval("PacLis_Fecha","{0:dd/MM/yyyy}") %>
                                </ItemTemplate>
                            </asp:TemplateField>
                            
                            <asp:TemplateField>
                                <HeaderStyle ForeColor="White" Font-Bold="true"></HeaderStyle>
                                <HeaderTemplate>
                                    <span class="column-sort">
									    <asp:LinkButton ID="lnkSortUpDescripcion" CssClass="sort-up" runat="server" CommandName="SortUp" CommandArgument="Descripcion"/>
                                        <asp:LinkButton ID="lnkSortDownDescripcion" CssClass="sort-down" runat="server"  CommandName="SortDown" CommandArgument="Descripcion"/>
								    </span>
                                   Descripción
                                </HeaderTemplate>
                                <ItemTemplate>
                                    <%# Eval("PacLis_Descripcion")%>
                                </ItemTemplate>
                            </asp:TemplateField>

                             <asp:TemplateField>
                                <HeaderStyle ForeColor="White" Font-Bold="true"></HeaderStyle>
                                <HeaderTemplate>
                                    <span class="column-sort">
									    <asp:LinkButton ID="lnkSortUpCliente" CssClass="sort-up" runat="server" CommandName="SortUp" CommandArgument="Cliente"/>
                                        <asp:LinkButton ID="lnkSortDownCliente" CssClass="sort-down" runat="server"  CommandName="SortDown" CommandArgument="Cliente"/>
								    </span>
                                   Cliente
                                </HeaderTemplate>
                                <ItemTemplate>
                                    <%# Eval("CO_PedidoCompra.TG_Cliente.Nombre")%>
                                </ItemTemplate>
                            </asp:TemplateField>

                            <asp:TemplateField>
                                <HeaderStyle ForeColor="White" Font-Bold="true"></HeaderStyle>
                                <HeaderTemplate>
                                    <span class="column-sort">
									    <asp:LinkButton ID="lnkSortUpEstado" CssClass="sort-up" runat="server" CommandName="SortUp" CommandArgument="Estado"/>
                                        <asp:LinkButton ID="lnkSortDownEstado" CssClass="sort-down" runat="server"  CommandName="SortDown" CommandArgument="Estado"/>
								    </span>
                                   Estado
                                </HeaderTemplate>
                                <ItemTemplate>
                                    <asp:Label ID="lblEstado" runat="server" Text='<%# Eval("PacLis_Estado") %>' ></asp:Label>                                      
                                </ItemTemplate> 
                            </asp:TemplateField>  
                          
						</Columns>  
						<PagerSettings Visible="false" />
					</asp:GridView>
				 </div>
                <ul class="message no-margin">
                    <li>
                        <asp:Label ID="lblMensajeGridFooter" runat="server"></asp:Label>
                    </li>
				</ul>
				<div class="block-footer">
                    <img src="images/icons/fugue/arrow-curve-000-left.png" width="16" height="16" class="picto"> 
                    <asp:LinkButton ID="btnAdicionar" runat="server" Text="Adicionar" CssClass="button" onclick="btnAdicionar_Click" />
				    <asp:LinkButton ID="btnModificar" runat="server" Text="Modificar" CssClass="button" onclick="btnModificar_Click" />
					<asp:LinkButton ID="btnEliminar" runat="server" Text="Eliminar" CssClass="button" onclick="btnEliminar_Click" OnClientClick="return DeleteRegistro();"/>                   					
                    <asp:LinkButton ID="btnEditarDetalle" runat="server" Text="Detalle" 
                        CssClass="button" onclick="btnEditarDetalle_Click"/>                    
                    <asp:LinkButton ID="btnAbrirCerrar" runat="server" Text="Abrir/Cerrar"  CssClass="button"/>
                    <asp:LinkButton ID="btnImprimir" runat="server" Text="Imprimir" CssClass="button"/>                    
                </div>
			</form>
			</div>
		</section>
	</article>

     <script type="text/javascript">

         function ValidarInputNumerico(e) {
             var valid = "0123456789"
             return ValidaInput(valid, e);
         }


         function ValidaInput(valid, e) {
             var keyAscii = (document.all) ? event.keyCode : e.which;
             if (keyAscii != 13) {
                 var key = String.fromCharCode(keyAscii);
                 var keyAj = key.toUpperCase();
                 if (valid == '') {
                     return true;
                 }
                 if (valid.indexOf(keyAj) == "-1") {
                     if (keyAscii != 8 && keyAscii != 0) { return false };
                     return true;
                 }
                 return true;
             }
         }

    </script>
</asp:Content>
